package cn.fl.login.controller.filter;

import cn.fl.framework.base.context.CurrentThreadContext;

import javax.servlet.*;
import java.io.IOException;

public class CurrentThreadContextFilter implements Filter {
    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        CurrentThreadContext.setValue(CurrentThreadContext.CURRENT_USER_ID, cn.lionbridge.center.context.CurrentThreadContext.getCurrentUserId());
        CurrentThreadContext.setValue(CurrentThreadContext.CURRENT_USER_NAME, cn.lionbridge.center.context.CurrentThreadContext.getCurrentUserName());
        CurrentThreadContext.setValue(CurrentThreadContext.CURRENT_USER_INFO, cn.lionbridge.center.context.CurrentThreadContext.getCurrentUserInfo());
        CurrentThreadContext.setValue(CurrentThreadContext.CURRENT_ORG_CD, cn.lionbridge.center.context.CurrentThreadContext.getCurrentOrgCd());
        CurrentThreadContext.setValue(CurrentThreadContext.CURRENT_ROLE_ID, cn.lionbridge.center.context.CurrentThreadContext.getCurrentRoleId());
        CurrentThreadContext.setValue(CurrentThreadContext.CURRENT_ROLE_NM, cn.lionbridge.center.context.CurrentThreadContext.getCurrentRoleNm());
        CurrentThreadContext.setValue(CurrentThreadContext.CURRENT_ORG_NM, cn.lionbridge.center.context.CurrentThreadContext.getCurrentOrgNm());
        CurrentThreadContext.setValue(CurrentThreadContext.CURRENT_ORG_ID, cn.lionbridge.center.context.CurrentThreadContext.getCurrentOrgId());
        CurrentThreadContext.setValue(CurrentThreadContext.CURRENT_ORG_SHT_NM, cn.lionbridge.center.context.CurrentThreadContext.getCurrentOrgShtNm());
        CurrentThreadContext.setValue(CurrentThreadContext.CURRENT_ORG_DISP_NM, cn.lionbridge.center.context.CurrentThreadContext.getCurrentOrgDispNm());
        CurrentThreadContext.setValue(CurrentThreadContext.CURRENT_ORG_TYP_CD, cn.lionbridge.center.context.CurrentThreadContext.getCurrentOrgTypCd());
        CurrentThreadContext.setValue(CurrentThreadContext.CURRENT_ORG_RGN_CD, cn.lionbridge.center.context.CurrentThreadContext.getCurrentRgnDivCd());
		CurrentThreadContext.setValue(CurrentThreadContext.CURRENT_ORG_RGN_CD_NM, cn.lionbridge.center.context.CurrentThreadContext.getCurrentRgnDivCdNm());
        CurrentThreadContext.setValue(CurrentThreadContext.CURRENT_ROLE_GRP_ID, cn.lionbridge.center.context.CurrentThreadContext.getCurrentRoleGrpId());
        chain.doFilter(request, response);
    }

    @Override
    public void destroy() {

    }
}
